properly handle revision based_on
field
#6580
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
mozilla/sumo#2262
Notes
This PR takes care of properly handling the
based_on
field within the delete user pipeline.based_on
of these revisions currently gets set to either null (if no prior revision yet exists) or some other prior revision within the same document. It's never used after that, but it does get set. So when we delete un-approved revisions of parent documents, we risk deleting not only other revisions via thebased_on
cascade, but the entire parent document because the chain of cascades often reaches thecurrent_revision
, which then pulls in the document.based_on
of one or more revisions of parent documents, we prevent the cascade deletion of these by setting theirbased_on
toNone
.based_on
of these revisions is always set to a revision within the translation's parent, but should always refer to an approved revision.based_on
because if itsbased_on
refers to an un-approved revision, it should be deleted.